import { ORDER_OFFSET_TYPE_OPEN } from '../actions/tradeOrderBoardAction'

import { fromJS } from 'immutable'

export const TRADE_ORDER_BOARD_ACTION = 'trade_order_board_action'

const initialState = fromJS({
  currentOrderOffsetType: ORDER_OFFSET_TYPE_OPEN,
  price: '',
  volume: '',
  errorTipText: ''
})

export default (state = initialState, action) => {
  if (action.type === TRADE_ORDER_BOARD_ACTION) {
    return state.merge(action.data)
  }
  return state
}
